<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.9/vue.js"></script>


<body>
    <div id="box">
        <h1>{{count}}</h1>
        <button v-on:click="count+=1">表单式</button><br>
        <button v-on:click="add">add</button><br>
        <button v-on:click="add1($event,num)">add()</button><br>
        <button @click='add'>简写方式</button>
    </div>
    <script>
        const vm = new Vue({
            el: '#box',
            data: {
                count: 0,
                num: 10
            },
            methods: {
                add(event) {
                    console.log(this);
                    this.count += 1;
                    console.log(event);
                },
                add1(event, dis) {
                    this.count += dis;
                    console.log(event);
                }
            }
        })
    </script>
</body>

</html>